//package difed.restaurante.util;
//
//import java.util.List;
//
//import android.app.Activity;
//import android.graphics.Typeface;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ArrayAdapter;
//import android.widget.CheckBox;
//import android.widget.CompoundButton;
//import android.widget.TextView;
//import difed.restaurante.R;
//import difed.restaurante.entidades.RestCheck;
//
//public class InteractiveArrayAdapter extends ArrayAdapter<RestCheck> {
//
//    private final List<RestCheck> list;
//    private final Activity context;
//
//    public InteractiveArrayAdapter(Activity context, List<RestCheck> list) {
//        super(context, R.layout.expimp, list);
//        this.context = context;
//        this.list = list;
//    }
//
//    static class ViewHolder {
//        protected TextView text;
//        protected CheckBox checkbox;
//    }
//
//    @Override
//    public View getView(int position, View convertView, ViewGroup parent) {
//        View view = null;
//        if (convertView == null) {
//            LayoutInflater inflator = context.getLayoutInflater();
//            view = inflator.inflate(R.layout.expimp, null);
//            final ViewHolder viewHolder = new ViewHolder();
//            viewHolder.text = (TextView) view.findViewById(R.id.label);
//            viewHolder.checkbox = (CheckBox) view.findViewById(R.id.e);
//            viewHolder.checkbox
//                    .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
//
//                        @Override
//                        public void onCheckedChanged(CompoundButton buttonView,
//                                boolean isChecked) {
//                            RestCheck element = (RestCheck) viewHolder.checkbox
//                                    .getTag();
//                            element.setSelected(buttonView.isChecked());
//
//                        }
//                    });
//            view.setTag(viewHolder);
//            viewHolder.checkbox.setTag(list.get(position));
//        } else {
//            view = convertView;
//            ((ViewHolder) view.getTag()).checkbox.setTag(list.get(position));
//        }
//        ViewHolder holder = (ViewHolder) view.getTag();
//        holder.text.setText(list.get(position).getNombre());
//        holder.checkbox.setChecked(list.get(position).isSelected());
//        return view;
//    }
//}
//
//            